package com.hot100;

public class Solution11 {
    public int maxArea(int[] height) {
        int i = 0;
        int j = height.length;
        int res = 0;
        while (i < j) {
            res = height[i] < height[j]?
                    Math.max((j-i)*height[i++],res):
                    Math.max((j-i)*height[j--],res);
        }
        return res;
    }
}
